package com.example.team.HotelTitle.Controller;

import com.example.team.HotelTitle.Entity.TitleEntity;
import com.example.team.HotelTitle.Service.Biz.TitleBiz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * ClassName:SelectAllController
 * Description:
 *
 * @Author: fy.chg
 * @CreateTime:2024/1/14 10:25
 */

@RestController
@RequestMapping("/title")
@CrossOrigin
public class TitleController {
    @Autowired
    TitleBiz titleBiz;
    // 显示所有数据 /selectAll
    @GetMapping("/selectAll")
    List<TitleEntity> selectAll(){
        return titleBiz.selectAll() ;
    }

    //显示单个详细数据 /show
    @GetMapping("/show")
    TitleEntity show(@RequestParam int id){
        return  titleBiz.show(id) ;
    }

    //添加信息
    @PostMapping("/add")
    int add(@RequestBody TitleEntity titleEntity){
        return titleBiz.add(titleEntity) ;
    }
    //根据state和reservation查询数据
    @PostMapping("/selectByState")
    List<TitleEntity> selectByState(@RequestBody TitleEntity titleEntity){
        return titleBiz.selectByState(titleEntity) ;
    }

}
